﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;

namespace Library.Linq
{
    public interface IGroupBy<T>
    {
        [Pure]
        IEnumerable<System.Linq.IGrouping<TKey, T>> GroupBy<TKey>(Func<T, TKey> keySelector);
        [Pure]
        IEnumerable<System.Linq.IGrouping<TKey, T>> GroupBy<TKey>(Func<T, TKey> keySelector, IEqualityComparer<TKey> comparer);
        [Pure]
        IEnumerable<System.Linq.IGrouping<TKey, TElement>> GroupBy<TKey, TElement>(Func<T, TKey> keySelector, Func<T, TElement> elementSelector);
        [Pure]
        IEnumerable<System.Linq.IGrouping<TKey, TElement>> GroupBy<TKey, TElement>(Func<T, TKey> keySelector, Func<T, TElement> elementSelector, IEqualityComparer<TKey> comparer);
        [Pure]
        IEnumerable<TResult> GroupBy<TKey, TResult>(Func<T, TKey> keySelector, Func<TKey, IEnumerable<T>, TResult> resultSelector);
        [Pure]
        IEnumerable<TResult> GroupBy<TKey, TResult>(Func<T, TKey> keySelector, Func<TKey, IEnumerable<T>, TResult> resultSelector, IEqualityComparer<TKey> comparer);
        [Pure]
        IEnumerable<TResult> GroupBy<TKey, TElement, TResult>(Func<T, TKey> keySelector, Func<T, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector);
        [Pure]
        IEnumerable<TResult> GroupBy<TKey, TElement, TResult>(Func<T, TKey> keySelector, Func<T, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer);
    }
}
